// 题型

const { STRING, INTEGER } = require('sequelize');

const sequelize = require('../sequelize');
const question = require('./question');

const questiontype = sequelize.define('questiontype', {
    title: {
        type: STRING,
        allowNull: false,
        unique: true,
        comment: '题型'
    },
    tourl:{
        type: STRING,
        allowNull: false,
        unique: true,
        comment: '路由'
    },
    name:{
        type: STRING,
        allowNull: false,
        unique: true,
        comment: '路由'

    }
}, { timestamps: false, underscored: true });

questiontype.associate = () => {
    questiontype.hasMany(question, {
        foreignKey: 'type_id',
        target: 'id',
    });
};

module.exports = questiontype;